package com.luoran.bartalks.utils;

import java.text.SimpleDateFormat;

import com.luoran.bartalks.action.vo.MaterialMoveVo;

/**
 * 货物移动取列名
 * 
 * @author WMM 2018年10月23日上午10:25:21
 * @version 1.0
 */
public enum EnumMaterielMoveColumnName {

	POSITION(0, "位置"), CONTAINER(1, "相关容器"), BIZTYPE(2, "业务类型"), PERSON(3, "业务人员"), BIZDAATE(4, "业务时间");
	private final Integer value;
	private final String name;

	EnumMaterielMoveColumnName(Integer value, String name) {
		this.value = value;
		this.name = name;
	}

	public Integer getValue() {
		return this.value;
	}

	public String getName() {
		return this.name;
	}

	public static String getColumnName(Integer value) {
		String name = "";
		switch (value) {
		case 0:
			name = POSITION.getName();
			break;
		case 1:
			name = CONTAINER.getName();
			break;
		case 2:
			name = BIZTYPE.getName();
			break;
		case 3:
			name = PERSON.getName();
			break;
		case 4:
			name = BIZDAATE.getName();
			break;
		default:
			name = "未知";
			break;
		}
		return name;
	}

	public static String getMethod(Integer value, MaterialMoveVo data) {
		String text = "";
		switch (value) {
		case 0:
			text = data.getAddressName();
			break;
		case 1:
			text = data.getContainerName();
			break;
		case 2:
			text = data.getBizType() == 10 ? "装货" : "卸货";
			break;
		case 3:
			text = data.getUserName();
			break;
		case 4:
			text = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data.getOperationDate());
			break;
		default:
			text = "";
			break;
		}
		if (text == null) {
			text = "";
		}
		return text;
	}

}
